package com.company;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Random;

public class SingleTask {

    public static void task(int fileNumber, String content) throws IOException {
        String fileName = "D:\\test\\single";
        for (int i = 0; i < fileNumber; i++) {
            try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter( fileName + i + ".txt"))){
                bufferedWriter.write(content);
            }
        }
    }

    //length用户要求产生字符串的长度
    public static String getRandomString(int length){
        String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for(int i = 0; i < length; i++){
            int number=random.nextInt(62);
            sb.append(str.charAt(number));
        }
        return sb.toString();
    }



    public static void main(String[] args) throws IOException {

    }
}
